<?php

namespace App\Validate;

class CouponValidation extends BaseValidation
{
    //  check 方法的参数
    // * @param array   $data 数据
    // * @param string  $scene 验证场景
    // * @param mixed   $rules 验证规则
    // * @param array  $message 自定义验证信息

    // 调用案例 

    // make(AmountValidation::class)->check($this->request->all(),__FUNCTION__)

    //返回响应值的  ->response()

    //返回boole   ->get()

    //返回报错信息  ->getError()

    //验证规则
    protected $rule = [
        'id' => 'required',
        'name' => 'required',
        'amount' => 'required|numeric',
        'batch' => 'required|numeric',
        'type' => 'required|numeric',
        'number' => 'required|max:200000',
        'coupon_id' => 'required',
        'openid' => 'required',
    ];
    //自定义验证信息
    protected $message = [];

    //自定义场景
    protected $scene = [
        'generateCoupon' => ['name', 'batch', 'type', 'number', 'amount'],
        'batchEdit' => ['id', 'name'],
        'couponBatch'=> ['id'],
        'batchDel' => ['id'],
        'receive' => ['openid', 'coupon_id'],
        'rpcCouponService' => ['openid', 'coupon_id']
    ];
}
